package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                                                                    import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.CustBaseChangeLogMapper;
import com.ruoyi.bizsys.domain.CustBaseChangeLog;
import com.ruoyi.bizsys.service.ICustBaseChangeLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 信息变更记录Service业务层处理
 *
 * @author african-loan
 * @date 2021-10-28
 */
@Service
public class CustBaseChangeLogServiceImpl extends ServiceImpl<CustBaseChangeLogMapper,CustBaseChangeLog> implements ICustBaseChangeLogService {

    /**
     * 查询信息变更记录
     *
     * @param id 信息变更记录ID
     * @return 信息变更记录
     */
    @Override
    public CustBaseChangeLog selectCustBaseChangeLogById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询信息变更记录列表
     *
     * @param custBaseChangeLog 信息变更记录
     * @return 信息变更记录
     */
    @Override
    public List<CustBaseChangeLog> selectCustBaseChangeLogList(CustBaseChangeLog custBaseChangeLog) {
        return this.list(new QueryWrapper<>(custBaseChangeLog).last("order by id desc"));
    }

    /**
     * 新增信息变更记录
     *
     * @param custBaseChangeLog 信息变更记录
     * @return 结果
     */
            @Override
    public int insertCustBaseChangeLog(CustBaseChangeLog custBaseChangeLog) {
                                                                                                                                                                                                    custBaseChangeLog.setCreateTime(DateUtils.getNowDate());
                                                                    return baseMapper.insert(custBaseChangeLog);
    }

    /**
     * 修改信息变更记录
     *
     * @param custBaseChangeLog 信息变更记录
     * @return 结果
     */
            @Override
    public int updateCustBaseChangeLog(CustBaseChangeLog custBaseChangeLog) {
                                                                                                                                                                                                                                            custBaseChangeLog.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(custBaseChangeLog);
    }

    /**
     * 批量删除信息变更记录
     *
     * @param ids 需要删除的信息变更记录ID
     * @return 结果
     */
            @Override
    public int deleteCustBaseChangeLogByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除信息变更记录信息
     *
     * @param id 信息变更记录ID
     * @return 结果
     */
    @Override
    public int deleteCustBaseChangeLogById(Long id) {
        return baseMapper.deleteById(id);
    }

}
